package com.yckj.activechicken.business.system.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.yckj.activechicken.framework.aspectj.lang.annotation.Excel;
import com.yckj.activechicken.framework.aspectj.lang.annotation.Excels;
import com.yckj.activechicken.framework.web.domain.BaseEntity;

import java.util.Date;
import java.util.List;
import java.util.Set;

public class SysUser extends BaseEntity {
    /**
     * 用户id，只应用导出
     */
    @Excel(name = "用户序号", cellType = Excel.ColumnType.NUMERIC, type = Excel.Type.EXPORT ,prompt = "用户编号")
    private Integer userId;

    private Integer empId;

    private Integer companyId;

    private Integer deptId;

    private Integer postId;

    private String loginName;

    @Excel(name = "登录名称")
    private String userName;

    private String userType;

    private String password;

    private String salt;

    @Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
    private String status;

    private String refuseDes;

    private String delFlag;

    @Excel(name = "操作用户")
    private String createBy;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    private String updateBy;

    @Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Excel.Type.EXPORT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    private String remark;

    private String avatar;

    /** 开始时间 */
    @JsonIgnore
    private String beginTime;

    /** 结束时间 */
    @JsonIgnore
    private String endTime;

    /**
     * 部门对象
     */
    @Excels({
            @Excel(name = "部门名称", targetAttr = "deptName", type = Excel.Type.EXPORT),
            @Excel(name = "部门负责人", targetAttr = "leader", type = Excel.Type.EXPORT)
    })
    private SysDept dept;

    /**
     * 角色对象
     */
    private List<SysRole> roles;

    /**
     * 角色对象
     */
    private Set<SysPost> posts;

    /**
     * 角色组
     */
    private Integer[] roleIds;

    /**
     * 岗位组
     */
    private Integer[] postIds;

    /** 数据权限 */
    private String dataScope;

    /**
     * 角色id，查询使用
     */
    private Integer roleId;

    /**
     * HrEmployee数据
     */
    @Excel(name = "员工姓名")
    private String name;

    @Excel(name = "性别",readConverterExp = "0=男,1=女")
    private String sex;

    @Excel(name = "身份证号")
    private String idCard;

    @Excel(name = "出生日期", width = 30, dateFormat = "yyyy-MM-dd")
    private String birthday;

    @Excel(name = "住址")
    private String address;

    @Excel(name = "是否婚配")
    private String isMarital;

    @Excel(name = "配偶姓名")
    private String spouseCompleteName;

    @Excel(name = "配偶生日", width = 30, dateFormat = "yyyy-MM-dd")
    private String spouseBirthday;

    @Excel(name = "子女人数",cellType = Excel.ColumnType.NUMERIC)
    private Integer childrenNum;

    @Excel(name = "联系电话")
    private String mobilePhone;

    @Excel(name = "邮箱")
    private String email;

    @Excel(name = "办公电话")
    private String workPhone;

    @Excel(name = "办公邮箱")
    private String workEmail;

    @Excel(name = "办公地址")
    private String workLocation;

    private String contractWarning;

    private Integer jobTypeId;

    private Integer profTypeId;

    private Integer eduResumeId;

    private Integer jobResumeId;

    private Integer color;

    private Integer badgeId;

    private String coachName;

    private String isActive;

    private String departureReason;

    private String departureDescription;

    private Integer pageNum;

    private Integer pageSize;

    private Integer myPageNum;

    private Integer mybeginNum;

    private static final long serialVersionUID = 1L;

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public Integer getEmpId() {
        return empId;
    }

    public void setEmpId(Integer empId) {
        this.empId = empId;
    }

    public Integer getCompanyId() {
        return companyId;
    }

    public void setCompanyId(Integer companyId) {
        this.companyId = companyId;
    }

    public Integer getDeptId() {
        return deptId;
    }

    public void setDeptId(Integer deptId) {
        this.deptId = deptId;
    }

    public Integer getPostId() {
        return postId;
    }

    public void setPostId(Integer postId) {
        this.postId = postId;
    }

    public String getLoginName() {
        return loginName;
    }

    public void setLoginName(String loginName) {
        this.loginName = loginName == null ? null : loginName.trim();
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName == null ? null : userName.trim();
    }

    public String getUserType() {
        return userType;
    }

    public void setUserType(String userType) {
        this.userType = userType == null ? null : userType.trim();
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password == null ? null : password.trim();
    }

    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt == null ? null : salt.trim();
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status == null ? null : status.trim();
    }

    public String getRefuseDes() {
        return refuseDes;
    }

    public void setRefuseDes(String refuseDes) {
        this.refuseDes = refuseDes == null ? null : refuseDes.trim();
    }

    public String getDelFlag() {
        return delFlag;
    }

    public void setDelFlag(String delFlag) {
        this.delFlag = delFlag == null ? null : delFlag.trim();
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar == null ? null : avatar.trim();
    }

    public SysDept getDept() {
        return dept;
    }

    public void setDept(SysDept dept) {
        this.dept = dept;
    }

    public List<SysRole> getRoles() {
        return roles;
    }

    public void setRoles(List<SysRole> roles) {
        this.roles = roles;
    }

    public Integer[] getRoleIds() {
        return roleIds;
    }

    public void setRoleIds(Integer[] roleIds) {
        this.roleIds = roleIds;
    }

    public Integer[] getPostIds() {
        return postIds;
    }

    public void setPostIds(Integer[] postIds) {
        this.postIds = postIds;
    }

    public boolean isAdmin() {
        return isAdmin(this.userId);
    }

    public static boolean isAdmin(Integer userId) {
        return userId != null && 1 == userId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getIdCard() {
        return idCard;
    }

    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }

    public String getBirthday() {
        return birthday;
    }

    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getIsMarital() {
        return isMarital;
    }

    public void setIsMarital(String isMarital) {
        this.isMarital = isMarital;
    }

    public String getSpouseCompleteName() {
        return spouseCompleteName;
    }

    public void setSpouseCompleteName(String spouseCompleteName) {
        this.spouseCompleteName = spouseCompleteName;
    }

    public String getSpouseBirthday() {
        return spouseBirthday;
    }

    public void setSpouseBirthday(String spouseBirthday) {
        this.spouseBirthday = spouseBirthday;
    }

    public Integer getChildrenNum() {
        return childrenNum;
    }

    public void setChildrenNum(Integer childrenNum) {
        this.childrenNum = childrenNum;
    }

    public String getMobilePhone() {
        return mobilePhone;
    }

    public void setMobilePhone(String mobilePhone) {
        this.mobilePhone = mobilePhone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getWorkPhone() {
        return workPhone;
    }

    public void setWorkPhone(String workPhone) {
        this.workPhone = workPhone;
    }

    public String getWorkEmail() {
        return workEmail;
    }

    public void setWorkEmail(String workEmail) {
        this.workEmail = workEmail;
    }

    public String getWorkLocation() {
        return workLocation;
    }

    public void setWorkLocation(String workLocation) {
        this.workLocation = workLocation;
    }

    public String getContractWarning() {
        return contractWarning;
    }

    public void setContractWarning(String contractWarning) {
        this.contractWarning = contractWarning;
    }

    public Integer getJobTypeId() {
        return jobTypeId;
    }

    public void setJobTypeId(Integer jobTypeId) {
        this.jobTypeId = jobTypeId;
    }

    public Integer getProfTypeId() {
        return profTypeId;
    }

    public void setProfTypeId(Integer profTypeId) {
        this.profTypeId = profTypeId;
    }

    public Integer getEduResumeId() {
        return eduResumeId;
    }

    public void setEduResumeId(Integer eduResumeId) {
        this.eduResumeId = eduResumeId;
    }

    public Integer getJobResumeId() {
        return jobResumeId;
    }

    public void setJobResumeId(Integer jobResumeId) {
        this.jobResumeId = jobResumeId;
    }

    public Integer getColor() {
        return color;
    }

    public void setColor(Integer color) {
        this.color = color;
    }

    public Integer getBadgeId() {
        return badgeId;
    }

    public void setBadgeId(Integer badgeId) {
        this.badgeId = badgeId;
    }

    public String getCoachName() {
        return coachName;
    }

    public void setCoachName(String coachName) {
        this.coachName = coachName;
    }

    public String getIsActive() {
        return isActive;
    }

    public void setIsActive(String isActive) {
        this.isActive = isActive;
    }

    public String getDepartureReason() {
        return departureReason;
    }

    public void setDepartureReason(String departureReason) {
        this.departureReason = departureReason;
    }

    public String getDepartureDescription() {
        return departureDescription;
    }

    public void setDepartureDescription(String departureDescription) {
        this.departureDescription = departureDescription;
    }

    public Set<SysPost> getPosts() {
        return posts;
    }

    public void setPosts(Set<SysPost> posts) {
        this.posts = posts;
    }

    public Integer getRoleId() {
        return roleId;
    }

    public void setRoleId(Integer roleId) {
        this.roleId = roleId;
    }

    public Integer getPageNum() {
        return pageNum;
    }

    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }


    public Integer getMyPageNum() {
        return myPageNum;
    }

    public void setMyPageNum(Integer myPageNum) {
        this.myPageNum = myPageNum;
    }

    public Integer getMybeginNum() {
        return mybeginNum;
    }

    public void setMybeginNum(Integer mybeginNum) {
        this.mybeginNum = mybeginNum;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", userId=").append(userId);
        sb.append(", empId=").append(empId);
        sb.append(", companyId=").append(companyId);
        sb.append(", deptId=").append(deptId);
        sb.append(", postId=").append(postId);
        sb.append(", loginName=").append(loginName);
        sb.append(", userName=").append(userName);
        sb.append(", userType=").append(userType);
        sb.append(", password=").append(password);
        sb.append(", salt=").append(salt);
        sb.append(", status=").append(status);
        sb.append(", refuseDes=").append(refuseDes);
        sb.append(", delFlag=").append(delFlag);
        sb.append(", createBy=").append(createBy);
        sb.append(", createTime=").append(createTime);
        sb.append(", updateBy=").append(updateBy);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", remark=").append(remark);
        sb.append(", avatar=").append(avatar);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}